<template>
	<view class="all_lotteries">
		<view class="" v-if="drawList.length">
			<view class="row bgc_fff clearfix mb15" v-for="(item, index) in drawList" :key="index"
				@click="whxfn1(item, index)">
				<view class="flexbetween mb12">
					<view class="levelname otw"> {{ item.level_name }} </view>
					<view class="hxbox hxbox2" v-if="item.status==0"> 未核销 </view>
					<view class="hxbox" v-else> 已核销 </view>

				</view>
				<view class="f28 c_696969 mb12">
					{{ item.draw_name }} x1
				</view>
				<!-- <view class="borderb f28 c_696969 mb20">
					黑色
				</view> -->
				<view class="flex mb20" v-if="item.status==0">
					<view class="title c_696969">
						兑奖期限：
					</view>
					<view class="otw info c_000">
						{{item.task_draw.startime}} 至 {{item.task_draw.endtime}}
					</view>
				</view>
				<view class="flex mb20">
					<view class="title c_696969">
						活动：
					</view>
					<view class="otw info c_000">
						{{ item.task.name }}
					</view>
				</view>
				<view class="flex mb20">
					<view class="title c_696969">
						核销方式：
					</view>
					<view class="otw info c_000">
						{{ item.task_draw.draw_type==1?"线上":"线下" }}
					</view>
				</view>
				<view class="flex mb20">
					<view class="title c_696969">
						核销时间：
					</view>
					<view class="otw info c_000">
						<text v-if="item.last_time">
							<text v-if="item.address_time">{{
						                      new Date(item.last_time).getTime() >
						                      new Date(item.address_time).getTime()
						                        ? item.last_time
						                        : item.address_time
						                    }}</text>
							<text v-else>{{ item.last_time || "-" }}</text>
						</text>
						<text v-else-if="item.address_time">{{
						                    item.address_time || "-"
						                  }}</text>
						<text v-else>-</text>
					</view>
				</view>
				<view class="flex mb20 borderb">
					<view class="title c_696969">
						核销备注：
					</view>
					<view class="otw info c_000" v-if="item.more">
						{{ item.more.beizhu || "无" }}
					</view>
					<view class="otw info c_000" v-else>
						无
					</view>
				</view>
				<view class="flex mb20">
					<view class="title c_696969">
						收货地址：
					</view>
					<view class="info c_000" v-if="item.more">
						{{ item.more.name }} {{ item.more.phone }}
					</view>
					<view class="info c_000" v-else>
						-
					</view>
				</view>
				<!-- <image :src="`/${item.template.url}`" alt=""></image>
                <p v-for="(i, idx) in item.task_draw" :key="index+'_'+idx">
                    {{ `${i.level_name}: ${i.draw_name}*${i.draw_num}` }}
                </p>
                <p v-if="item.task_comfort">{{ `${item.task_comfort.level_name}: ${item.task_comfort.draw_name}*${item.task_comfort.draw_num}` }}</p>
                <p class="line"></p>
                <p class="fl">{{ type2[item.type] }}</p>
                <p class="fr c_C30000 fwb">{{ type1[item.status] }}</p> -->
			</view>
			<p v-if="showMore" class="tac mt20 f28 mb50" @click="loadMore">点击加载更多</p>
			<p v-else class="tac mt20 f28 mb50">没有更多了</p>
		</view>
		<view v-else class="tac f28 empty">
			暂无数据
		</view>
	</view>
</template>
<script>
	// status 已发布 4 已借su 0 daifabu
	// type 1 jichoujikai  2 dingshikaijiang 3满人开奖

	export default {
		props: ["taskId"],
		data() {
			return {
				drawList: [],


				type: '1',
				page: 1,
				num: 10,
				showMore: true
			}
		},
		mounted() {
			this.getDrawList();
		},
		methods: {
			whxfn1(item, index) {
				console.log(item)
				if (item.status !== 0) return
				var url = "/pagesPrize/aboutPrize/cashaprize?id=" +
					item.task.id +
					"&index=" +
					index +
					"&obj=" +
					JSON.stringify(item);
				uni.navigateTo({
					url
				})


			},
			back() {
				uni.navigateBack();
			},
			getDrawList() {
				uni.$http.get('/user/public/myWinIndex', {
					//	id: this.taskId,
					num: 20,
					page: this.page
				}).then(res => {
					if (res.data.data.list.length) {
						this.drawList.push(...res.data.data.list);
					} else {
						this.showMore = false;
					}
				})
			},


			loadMore() {
				this.page++;
				this.getDrawList();
			},
			jumpPage(item) {
				// if(item.status!==0) return
				uni.navigateTo({
					url: '/pagesMy/winndetail/index'
				})
				// uni.setStorageSync('task_info', value);
				// uni.navigateTo({ url: '/packages/myPrize/index' })
			}
		}
	}
</script>
<style lang="scss" scoped>
	.all_lotteries {
		height: 100%;
		overflow-y: auto;

		.levelname {
			width: 80%;
			font-size: 32rpx;
			color: #000;
		}

		.row {
			padding: 20rpx;
			border-radius: 20rpx;
		}

		.hxbox {
			padding: 6rpx 20rpx;
			border-radius: 40rpx;
			color: #868686;
			font-size: 26rpx;
			background-color: #F2F2F2;
			border: 1px solid #868686;
		}

		.hxbox2 {
			color: #B40000;
			background-color: #FDEDED;
			border: 1px solid #B90000;
		}

		.borderb {
			padding-bottom: 20rpx;
			border-bottom: 1px dashed #707070;
		}

		.title {
			width: 140rpx;
			font-size: 28rpx;
		}

		.info {
			width: calc(100% - 140rpx);
			font-size: 28rpx;
		}

		// .content {
		//     // padding: 20rpx;
		//     .row {
		//         background-color: #fff;
		//         padding: 20rpx;
		//         border-radius: 20rpx;
		//         image {
		//             width: 100%;
		//             border-radius: 20rpx;
		//         }
		//         p {
		//             line-height: 50rpx;
		//         }
		//         .line {
		//             margin: 10rpx 0;
		//             border-top: 1px dashed #707070;
		//         }
		//         .c_C30000 {
		//             color: #C30000;
		//         }
		//     }
		// }
		.empty {
			position: absolute;
			top: 50%;
			left: 50%;
			transform: translateX(-50%);
		}
	}
</style>